home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / Char.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  2.1 KB  |  51 lines

  1. package symantec.itools.db.net;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.IOException;
  6. import symjava.sql.SQLException;
  7.  
  8. class Char extends CharField {
  9.    int getType() {
  10.       return 69;
  11.    }
  12.  
  13.    void write(DataOutputStream out) throws IOException {
  14.       super.write(out);
  15.       NetString s = new NetString(super._data);
  16.       s.write(out);
  17.       EOT eot = new EOT();
  18.       eot.write(out);
  19.    }
  20.  
  21.    void read(DataInputStream in) throws SQLException, IOException, ErrorException {
  22.       super.read(in);
  23.       if (!super._null) {
  24.          ServerObject obj = (ServerObject)NetClass.getNextObject(in);
  25.          if (obj.getType() == 52) {
  26.             super._data = ((NetString)obj).toString();
  27.          } else {
  28.             ((ServerObject)this).onObjectError(obj);
  29.          }
  30.       }
  31.  
  32.       ServerObject obj = (ServerObject)NetClass.getNextObject(in);
  33.       if (obj.getType() != 50) {
  34.          ((ServerObject)this).onObjectError(obj);
  35.       }
  36.  
  37.    }
  38.  
  39.    public int getSQLType() {
  40.       return 1;
  41.    }
  42.  
  43.    public Object getObject() throws SQLException {
  44.       return ((CharField)this).getString();
  45.    }
  46.  
  47.    public void setObject(Object obj) throws SQLException {
  48.       ((CharField)this).setString((String)obj);
  49.    }
  50. }
  51.